<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div class="box" id="box">
    <p>111</p>
    <p>2</p>
    <p>3</p>
    <p>4</p>
    <p>5</p>
    <select name="" id="">
      <option value="ww">w1</option>
      <option value="e">e1</option>
      <option value="r">r1</option>
      <option value="t">t1</option>
    </select>
    <input type="button" value="1">
    <input type="button" value="2">
    <input type="button" value="3">
    <input type="button" value="4" disabled="disabled">
    <input type="button" value="5">
    <textarea name="" id="" cols="30" rows="10"></textarea>
  </div>
  <p>6</p>
  <script src="./jquery-1.12.4.min.js"></script>
  <script>
  console.log($(".box").html());
  console.log($("p").html());
  console.log($("input").html());
  console.log($("textarea").html());
  console.log($("select").html());
  console.log($("").html());
// 无法获取input的value

  console.log($(".box").text());
  console.log($("p").text());
  console.log($("input").text());
  console.log($("textarea").text());
  console.log($("select").text());
  // 无法获取input的value


  // val只针对表单元素 和html相似，只能获取第一个,设置可以设置所有
  console.log($(".box").val());
  console.log($("p").val());
  console.log($("input").val());
  console.log($("textarea").val());
  console.log($("select").val());
  console.log($("option").val());
 // 设置内容
 $("input").val("zz");
 $("textarea").val("sw");
 $("select").val("hu");
 $("option").val("bn");//不建议

 

  </script>
</body>
</html>